import { View } from "../../../mvc/core/View";
import { GTextFormat } from "../../../common/GTextFormat";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { ObjCreate } from "../common/ObjCreate";
//class GMarketButtonItem
    
    export  class GMarketButtonItem extends View
    {
        constructor(arg1: string)
        {
            super();
            this.init(arg1);
            buttonMode = true;
            mouseChildren = false;
            return;
        }

        /* internal  */init(arg1: string): void
        {
            this._yellowTf = new GTextFormat("Cambria", 14, 16776960);
            this._greenTf = new GTextFormat("Cambria", 14, 65280);
            this._closeIcon = GlobalClass.getBitmap(ImagesConst.TreeCloseIcon);
            this._closeIcon.x = 0;
            this._closeIcon.y = 0;
            this._closeIcon.visible = false;
            addChild(this._closeIcon);
            this._openIcon = GlobalClass.getBitmap(ImagesConst.TreeOpenIcon);
            this._openIcon.x = 0;
            this._openIcon.y = 0;
            addChild(this._openIcon);
            this._textfield = ObjCreate.createTextField(arg1, 20, 0, 100, 20, this);
            this._textfield.filters = [];
            return;
        }

        public setText(arg1: string): void
        {
            this._textfield.text = arg1;
            return;
        }

        public /* override */ set mouseEnabled(arg1: Boolean)
        {
            super.mouseEnabled = arg1;
            if (arg1) 
            {
                this._closeIcon.visible = false;
                this._openIcon.visible = true;
                this._textfield.setTextFormat(this._greenTf);
            }
            else 
            {
                this._closeIcon.visible = true;
                this._openIcon.visible = false;
                this._textfield.setTextFormat(this._yellowTf);
            }
            return;
        }

        public set isClose(arg1: Boolean)
        {
            this._isClose = arg1;
            if (arg1) 
            {
                this._closeIcon.visible = false;
                this._openIcon.visible = true;
                this._textfield.setTextFormat(this._greenTf);
            }
            else 
            {
                this._closeIcon.visible = true;
                this._openIcon.visible = false;
                this._textfield.setTextFormat(this._yellowTf);
            }
            return;
        }

        public get isClose(): Boolean
        {
            return this._isClose;
        }

        /* internal */ /* var */_textfield: Object /* flash.text.TextField */;

        /* internal */ /* var */_closeIcon: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_openIcon: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_yellowTf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_greenTf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_isClose: Boolean=true;
    }
